import 'package:image_picker/image_picker.dart';

class MyMediaPicker {
  static ImagePicker _picker = ImagePicker();

  static Future<List<MediaAssetDataEntity>> imgPick({bool isCamera = false}) async {
    List<MediaAssetDataEntity> list = [];
    XFile? file;
    try {
      file = await _picker.pickImage(
          source: isCamera ? ImageSource.camera : ImageSource.gallery, imageQuality: 80);
      if (file == null) {
        return [];
      }
      MediaAssetDataEntity dataEntity = MediaAssetDataEntity();
      dataEntity.uri = file.path;
      dataEntity.type = 1;
      list.add(dataEntity);
    } catch (e) {
      e.toString();
    }
    return list;
  }

}

class MediaAssetDataEntity{
  int type = 0;
  String uri = "";
}